package presentationTier.actions;

import businessTier.IMovieFacade;
import businessTier.MovieFacade;
import core.Medium;
import core.MovieException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import presentationTier.dialogs.AddMediumDialog;

/**
 *
 * @author vojta
 */
public class AddMediumOkAction implements ActionListener{

    AddMediumDialog dialog;

    public AddMediumOkAction(AddMediumDialog aThis) {
        dialog = aThis;
    }

    public void actionPerformed(ActionEvent e) {        
        try {
            String name = dialog.TxtName.getText();
            IMovieFacade f = MovieFacade.getInstance();
            Medium medium = new Medium(name);
            //JOptionPane.showMessageDialog(dialog, medium.getMedium());
            f.addMedium(medium);
            f.close();

            dialog.dispose();
        } catch (MovieException ex) {
            
        }
    }



}
